<?php
define('LIBS', 'lib');
define('INCLUDES', 'includes');

//include(INCLUDES . "/session.php");
include(LIBS . "/uarx/dbConnection.php");
include(LIBS . "/uarx/fileCacheEngine.php");

$GLOBALS['db'] = new dbConnection();
$GLOBALS['cache'] = new fileCacheEngine("uarxApp");

$GLOBALS['db']->query("SELECT * FROM categories where parent = 0");

$localResults = $GLOBALS['db']->get_results();

if(is_array($localResults)) echo "Al menos es un array lpmqlrmp<br>"; else echo "Ni siquiera es un array!<br>";
echo "<pre>";
print_r($localResults);
echo "</pre>";

if(is_array($localResults))
{
	foreach ($localResults as $category)
	{
		echo "Category name: " . $category[1] . "<BR>";
	}
}

$GLOBALS['db']->close();

// Try to save something to the cache
$GLOBALS['cache']->set_cache("categories", "Camisas \"mangas largas', Corbatas (de seda), Zapatos");

if($cached_data = $GLOBALS['cache']->get_cache("categories"))
{
	echo "Cached categories are: " . $cached_data . "<br>";
}

// Delete the created cache
$GLOBALS['cache']->unset_cache("categories");

?>